package com.example.mobile2021606185zhn0507;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private TextView edtTxtMainUsername;
    private TextView edtTxtMainPassword;
    private Button btnMainLogin;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        btnMainLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this,ShowDataActivity.class);

                intent.putExtra("userName",edtTxtMainUsername.getText().toString().trim());
                intent.putExtra("passWord",edtTxtMainPassword.getText().toString().trim());
                startActivity(intent);
            }
        });

    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tvMainTitle);
        edtTxtMainUsername = (TextView) findViewById(R.id.edtTxtMainUsername);
        edtTxtMainPassword = (TextView) findViewById(R.id.edtTxtMainPassword);
        btnMainLogin = (Button) findViewById(R.id.btnMainLogin);

    }


}